[gjs/wip/ptomato/mozjs45prep: 6/36] jsapi-class: Get rid of "proto_name" argument



commit 991b44117251f035b3693775dbc10c3dfed00ba9
Author: Philip Chimento <philip chimento gmail com>
Date:   Wed Apr 12 22:36:02 2017 -0700

    jsapi-class: Get rid of "proto_name" argument
    
    There's no need to have a "proto_name" that's different from the class's
    name. Getting rid of this distinction will allow us to refactor things so
    that JS_InitClass() defines the correct constructor directly on the global
    object or the module object.
    
    This is a small behavioural API break, since it changes the output of
    toString() on the various Cairo objects, but I would say that people
    should not be parsing the output of toString(). (I know we do in our tests,
    but that's terrible.)
    
    https://bugzilla.gnome.org/show_bug.cgi?id=614413

 gi/gtype.cpp                      |    3 +--
 gjs/jsapi-class.h                 |    5 ++---
 installed-tests/js/testCairo.js   |   26 +++++++++++++-------------
 modules/cairo-context.cpp         |    4 +++-
 modules/cairo-gradient.cpp        |    3 ++-
 modules/cairo-image-surface.cpp   |    3 ++-
 modules/cairo-linear-gradient.cpp |    3 ++-
 modules/cairo-path.cpp            |    2 +-
 modules/cairo-pattern.cpp         |    4 +++-
 modules/cairo-pdf-surface.cpp     |    3 ++-
 modules/cairo-private.h           |   14 --------------
 modules/cairo-ps-surface.cpp      |    2 +-
 modules/cairo-radial-gradient.cpp |    3 ++-
 modules/cairo-region.cpp          |    4 +++-
 modules/cairo-solid-pattern.cpp   |    3 ++-
 modules/cairo-surface-pattern.cpp |    3 ++-
 modules/cairo-surface.cpp         |    4 +++-
 modules/cairo-svg-surface.cpp     |    3 ++-
 modules/cairo.cpp                 |   26 +++++++++++++-------------
 19 files changed, 59 insertions(+), 59 deletions(-)
---
diff --git a/gi/gtype.cpp b/gi/gtype.cpp
index ffeb263..0301e3f 100644
--- a/gi/gtype.cpp
+++ b/gi/gtype.cpp
@@ -38,7 +38,6 @@ static std::set<GType> weak_pointer_list;
 static JSObject *
 gjs_gtype_create_proto(JSContext       *context,
                        JS::HandleObject module,
-                       const char      *proto_name,
                        JS::HandleObject parent);
 
 GJS_DEFINE_PROTO_ABSTRACT("GIRepositoryGType", gtype, 0);
@@ -156,7 +155,7 @@ gjs_gtype_create_gtype_wrapper (JSContext *context,
     /* put constructor for GIRepositoryGType() in the global namespace */
     JS::RootedObject global(context, gjs_get_import_global(context));
     JS::RootedObject proto(context,
-        gjs_gtype_create_proto(context, global, "GIRepositoryGType", JS::NullPtr()));
+        gjs_gtype_create_proto(context, global, JS::NullPtr()));
 
     auto heap_wrapper =
         static_cast<JS::Heap<JSObject *> *>(g_type_get_qdata(gtype, gjs_get_gtype_wrapper_quark()));
diff --git a/gjs/jsapi-class.h b/gjs/jsapi-class.h
index 2e6262a..9d75416 100644
--- a/gjs/jsapi-class.h
+++ b/gjs/jsapi-class.h
@@ -174,7 +174,6 @@ static struct JSClass gjs_##cname##_class = {                                \
 JSObject *                                                                   \
 gjs_##cname##_create_proto(JSContext       *cx,                              \
                            JS::HandleObject module,                          \
-                           const char      *proto_name,                      \
                            JS::HandleObject parent)                          \
 {                                                                            \
     JS::RootedObject rval(cx);                                               \
@@ -199,8 +198,8 @@ gjs_##cname##_create_proto(JSContext       *cx,                              \
         return nullptr;                                                      \
     if (found)                                                               \
         return rval;                                                         \
-    if (!JS_DefineProperty(cx, module, proto_name,                           \
-                           rval, GJS_MODULE_PROP_FLAGS))                     \
+    if (!JS_DefinePropertyById(cx, module, class_name,                       \
+                               rval, GJS_MODULE_PROP_FLAGS))                 \
         return nullptr;                                                      \
     if (gtype != G_TYPE_NONE) {                                              \
         JS::RootedObject gtype_obj(cx,                                       \
diff --git a/installed-tests/js/testCairo.js b/installed-tests/js/testCairo.js
index 0d08eee..75066be 100644
--- a/installed-tests/js/testCairo.js
+++ b/installed-tests/js/testCairo.js
@@ -24,13 +24,13 @@ describe('Cairo', function () {
         });
 
         it('reports its target surface', function () {
-            expect(_ts(cr.getTarget())).toEqual('CairoImageSurface');
+            expect(_ts(cr.getTarget())).toEqual('ImageSurface');
         });
 
         it('can set its source to a pattern', function () {
             let pattern = Cairo.SolidPattern.createRGB(1, 2, 3);
             cr.setSource(pattern);
-            expect(_ts(cr.getSource())).toEqual('CairoSolidPattern');
+            expect(_ts(cr.getSource())).toEqual('SolidPattern');
         });
 
         it('can set its antialias', function () {
@@ -178,50 +178,50 @@ describe('Cairo', function () {
 
             cr = Gdk.cairo_create(da.window);
             expect(cr.save).toBeDefined();
-            expect(_ts(cr.getTarget())).toEqual('CairoSurface');
+            expect(_ts(cr.getTarget())).toEqual('Surface');
         });
     });
 
     describe('solid pattern', function () {
         it('can be created from RGB static method', function () {
             let p1 = Cairo.SolidPattern.createRGB(1, 2, 3);
-            expect(_ts(p1)).toEqual('CairoSolidPattern');
+            expect(_ts(p1)).toEqual('SolidPattern');
             cr.setSource(p1);
-            expect(_ts(cr.getSource())).toEqual('CairoSolidPattern');
+            expect(_ts(cr.getSource())).toEqual('SolidPattern');
         });
 
         it('can be created from RGBA static method', function () {
             let p2 = Cairo.SolidPattern.createRGBA(1, 2, 3, 4);
-            expect(_ts(p2)).toEqual('CairoSolidPattern');
+            expect(_ts(p2)).toEqual('SolidPattern');
             cr.setSource(p2);
-            expect(_ts(cr.getSource())).toEqual('CairoSolidPattern');
+            expect(_ts(cr.getSource())).toEqual('SolidPattern');
         });
     });
 
     describe('surface pattern', function () {
         it('can be created and added as a source', function () {
             let p1 = new Cairo.SurfacePattern(surface);
-            expect(_ts(p1)).toEqual('CairoSurfacePattern');
+            expect(_ts(p1)).toEqual('SurfacePattern');
             cr.setSource(p1);
-            expect(_ts(cr.getSource())).toEqual('CairoSurfacePattern');
+            expect(_ts(cr.getSource())).toEqual('SurfacePattern');
         });
     });
 
     describe('linear gradient', function () {
         it('can be created and added as a source', function () {
             let p1 = new Cairo.LinearGradient(1, 2, 3, 4);
-            expect(_ts(p1)).toEqual('CairoLinearGradient');
+            expect(_ts(p1)).toEqual('LinearGradient');
             cr.setSource(p1);
-            expect(_ts(cr.getSource())).toEqual('CairoLinearGradient');
+            expect(_ts(cr.getSource())).toEqual('LinearGradient');
         });
     });
 
     describe('radial gradient', function () {
         it('can be created and added as a source', function () {
             let p1 = new Cairo.RadialGradient(1, 2, 3, 4, 5, 6);
-            expect(_ts(p1)).toEqual('CairoRadialGradient');
+            expect(_ts(p1)).toEqual('RadialGradient');
             cr.setSource(p1);
-            expect(_ts(cr.getSource())).toEqual('CairoRadialGradient');
+            expect(_ts(cr.getSource())).toEqual('RadialGradient');
         });
     });
 });
diff --git a/modules/cairo-context.cpp b/modules/cairo-context.cpp
index 2a1e225..91af786 100644
--- a/modules/cairo-context.cpp
+++ b/modules/cairo-context.cpp
@@ -238,7 +238,9 @@ typedef struct {
     cairo_t * cr;
 } GjsCairoContext;
 
-GJS_DEFINE_PROTO_WITH_GTYPE("CairoContext", cairo_context, CAIRO_GOBJECT_TYPE_CONTEXT, 
JSCLASS_BACKGROUND_FINALIZE)
+GJS_DEFINE_PROTO_WITH_GTYPE("Context", cairo_context,
+                            CAIRO_GOBJECT_TYPE_CONTEXT,
+                            JSCLASS_BACKGROUND_FINALIZE)
 GJS_DEFINE_PRIV_FROM_JS(GjsCairoContext, gjs_cairo_context_class);
 
 static void
diff --git a/modules/cairo-gradient.cpp b/modules/cairo-gradient.cpp
index c824eb5..3007f95 100644
--- a/modules/cairo-gradient.cpp
+++ b/modules/cairo-gradient.cpp
@@ -28,7 +28,8 @@
 #include <cairo.h>
 #include "cairo-private.h"
 
-GJS_DEFINE_PROTO_ABSTRACT("CairoGradient", cairo_gradient, JSCLASS_BACKGROUND_FINALIZE)
+GJS_DEFINE_PROTO_ABSTRACT("Gradient", cairo_gradient,
+                          JSCLASS_BACKGROUND_FINALIZE)
 
 static void
 gjs_cairo_gradient_finalize(JSFreeOp *fop,
diff --git a/modules/cairo-image-surface.cpp b/modules/cairo-image-surface.cpp
index b01bda2..7475c1d 100644
--- a/modules/cairo-image-surface.cpp
+++ b/modules/cairo-image-surface.cpp
@@ -29,7 +29,8 @@
 #include <cairo.h>
 #include "cairo-private.h"
 
-GJS_DEFINE_PROTO("CairoImageSurface", cairo_image_surface, JSCLASS_BACKGROUND_FINALIZE)
+GJS_DEFINE_PROTO("ImageSurface", cairo_image_surface,
+                 JSCLASS_BACKGROUND_FINALIZE)
 
 GJS_NATIVE_CONSTRUCTOR_DECLARE(cairo_image_surface)
 {
diff --git a/modules/cairo-linear-gradient.cpp b/modules/cairo-linear-gradient.cpp
index a7104c1..0822287 100644
--- a/modules/cairo-linear-gradient.cpp
+++ b/modules/cairo-linear-gradient.cpp
@@ -28,7 +28,8 @@
 #include <cairo.h>
 #include "cairo-private.h"
 
-GJS_DEFINE_PROTO("CairoLinearGradient", cairo_linear_gradient, JSCLASS_BACKGROUND_FINALIZE)
+GJS_DEFINE_PROTO("LinearGradient", cairo_linear_gradient,
+                 JSCLASS_BACKGROUND_FINALIZE)
 
 GJS_NATIVE_CONSTRUCTOR_DECLARE(cairo_linear_gradient)
 {
diff --git a/modules/cairo-path.cpp b/modules/cairo-path.cpp
index 57a1435..ac550e6 100644
--- a/modules/cairo-path.cpp
+++ b/modules/cairo-path.cpp
@@ -34,7 +34,7 @@ typedef struct {
     cairo_path_t    *path;
 } GjsCairoPath;
 
-GJS_DEFINE_PROTO_ABSTRACT("CairoPath", cairo_path, JSCLASS_BACKGROUND_FINALIZE)
+GJS_DEFINE_PROTO_ABSTRACT("Path", cairo_path, JSCLASS_BACKGROUND_FINALIZE)
 GJS_DEFINE_PRIV_FROM_JS(GjsCairoPath, gjs_cairo_path_class)
 
 static void
diff --git a/modules/cairo-pattern.cpp b/modules/cairo-pattern.cpp
index 0c44328..f987bd3 100644
--- a/modules/cairo-pattern.cpp
+++ b/modules/cairo-pattern.cpp
@@ -36,7 +36,9 @@ typedef struct {
     cairo_pattern_t *pattern;
 } GjsCairoPattern;
 
-GJS_DEFINE_PROTO_ABSTRACT_WITH_GTYPE("CairoPattern", cairo_pattern, CAIRO_GOBJECT_TYPE_PATTERN, 
JSCLASS_BACKGROUND_FINALIZE)
+GJS_DEFINE_PROTO_ABSTRACT_WITH_GTYPE("Pattern", cairo_pattern,
+                                     CAIRO_GOBJECT_TYPE_PATTERN,
+                                     JSCLASS_BACKGROUND_FINALIZE)
 GJS_DEFINE_PRIV_FROM_JS(GjsCairoPattern, gjs_cairo_pattern_class)
 
 static void
diff --git a/modules/cairo-pdf-surface.cpp b/modules/cairo-pdf-surface.cpp
index a2469be..e14b26e 100644
--- a/modules/cairo-pdf-surface.cpp
+++ b/modules/cairo-pdf-surface.cpp
@@ -31,7 +31,8 @@
 #if CAIRO_HAS_PDF_SURFACE
 #include <cairo-pdf.h>
 
-GJS_DEFINE_PROTO("CairoPDFSurface", cairo_pdf_surface, JSCLASS_BACKGROUND_FINALIZE)
+GJS_DEFINE_PROTO("PDFSurface", cairo_pdf_surface,
+                 JSCLASS_BACKGROUND_FINALIZE)
 
 GJS_NATIVE_CONSTRUCTOR_DECLARE(cairo_pdf_surface)
 {
diff --git a/modules/cairo-private.h b/modules/cairo-private.h
index 2435ed3..cd94ccd 100644
--- a/modules/cairo-private.h
+++ b/modules/cairo-private.h
@@ -32,14 +32,12 @@ bool             gjs_cairo_check_status                 (JSContext       *contex
 
 JSObject *gjs_cairo_region_create_proto(JSContext       *cx,
                                         JS::HandleObject module,
-                                        const char      *proto_name,
                                         JS::HandleObject parent);
 
 void             gjs_cairo_region_init                  (JSContext       *context);
 
 JSObject *gjs_cairo_context_create_proto(JSContext       *cx,
                                          JS::HandleObject module,
-                                         const char      *proto_name,
                                          JS::HandleObject parent);
 
 cairo_t *        gjs_cairo_context_get_context          (JSContext       *context,
@@ -53,7 +51,6 @@ void             gjs_cairo_surface_init                 (JSContext       *contex
 /* cairo_path_t */
 JSObject *gjs_cairo_path_create_proto(JSContext       *cx,
                                       JS::HandleObject module,
-                                      const char      *proto_name,
                                       JS::HandleObject parent);
 
 JSObject *       gjs_cairo_path_from_path               (JSContext       *context,
@@ -64,7 +61,6 @@ cairo_path_t *   gjs_cairo_path_get_path                (JSContext       *contex
 /* surface */
 JSObject *gjs_cairo_surface_create_proto(JSContext       *cx,
                                          JS::HandleObject module,
-                                         const char      *proto_name,
                                          JS::HandleObject parent);
 
 void             gjs_cairo_surface_construct            (JSContext       *context,
@@ -80,7 +76,6 @@ cairo_surface_t* gjs_cairo_surface_get_surface          (JSContext       *contex
 /* image surface */
 JSObject *gjs_cairo_image_surface_create_proto(JSContext       *cx,
                                                JS::HandleObject module,
-                                               const char      *proto_name,
                                                JS::HandleObject parent);
 
 void             gjs_cairo_image_surface_init           (JSContext       *context,
@@ -93,7 +88,6 @@ JSObject *       gjs_cairo_image_surface_from_surface   (JSContext       *contex
 #ifdef CAIRO_HAS_PS_SURFACE
 JSObject *gjs_cairo_ps_surface_create_proto(JSContext       *cx,
                                             JS::HandleObject module,
-                                            const char      *proto_name,
                                             JS::HandleObject parent);
 #endif
 JSObject *       gjs_cairo_ps_surface_from_surface       (JSContext       *context,
@@ -103,7 +97,6 @@ JSObject *       gjs_cairo_ps_surface_from_surface       (JSContext       *conte
 #ifdef CAIRO_HAS_PDF_SURFACE
 JSObject *gjs_cairo_pdf_surface_create_proto(JSContext       *cx,
                                              JS::HandleObject module,
-                                             const char      *proto_name,
                                              JS::HandleObject parent);
 #endif
 JSObject *       gjs_cairo_pdf_surface_from_surface     (JSContext       *context,
@@ -113,7 +106,6 @@ JSObject *       gjs_cairo_pdf_surface_from_surface     (JSContext       *contex
 #ifdef CAIRO_HAS_SVG_SURFACE
 JSObject *gjs_cairo_svg_surface_create_proto(JSContext       *cx,
                                              JS::HandleObject module,
-                                             const char      *proto_name,
                                              JS::HandleObject parent);
 #endif
 JSObject *       gjs_cairo_svg_surface_from_surface     (JSContext       *context,
@@ -122,7 +114,6 @@ JSObject *       gjs_cairo_svg_surface_from_surface     (JSContext       *contex
 /* pattern */
 JSObject *gjs_cairo_pattern_create_proto(JSContext       *cx,
                                          JS::HandleObject module,
-                                         const char      *proto_name,
                                          JS::HandleObject parent);
 
 void             gjs_cairo_pattern_construct            (JSContext       *context,
@@ -138,13 +129,11 @@ cairo_pattern_t* gjs_cairo_pattern_get_pattern          (JSContext       *contex
 /* gradient */
 JSObject *gjs_cairo_gradient_create_proto(JSContext       *cx,
                                           JS::HandleObject module,
-                                          const char      *proto_name,
                                           JS::HandleObject parent);
 
 /* linear gradient */
 JSObject *gjs_cairo_linear_gradient_create_proto(JSContext       *cx,
                                                  JS::HandleObject module,
-                                                 const char      *proto_name,
                                                  JS::HandleObject parent);
 
 JSObject *       gjs_cairo_linear_gradient_from_pattern (JSContext       *context,
@@ -153,7 +142,6 @@ JSObject *       gjs_cairo_linear_gradient_from_pattern (JSContext       *contex
 /* radial gradient */
 JSObject *gjs_cairo_radial_gradient_create_proto(JSContext       *cx,
                                                  JS::HandleObject module,
-                                                 const char      *proto_name,
                                                  JS::HandleObject parent);
 
 JSObject *       gjs_cairo_radial_gradient_from_pattern (JSContext       *context,
@@ -162,7 +150,6 @@ JSObject *       gjs_cairo_radial_gradient_from_pattern (JSContext       *contex
 /* surface pattern */
 JSObject *gjs_cairo_surface_pattern_create_proto(JSContext       *cx,
                                                  JS::HandleObject module,
-                                                 const char      *proto_name,
                                                  JS::HandleObject parent);
 
 JSObject *       gjs_cairo_surface_pattern_from_pattern (JSContext       *context,
@@ -171,7 +158,6 @@ JSObject *       gjs_cairo_surface_pattern_from_pattern (JSContext       *contex
 /* solid pattern */
 JSObject *gjs_cairo_solid_pattern_create_proto(JSContext       *cx,
                                                JS::HandleObject module,
-                                               const char      *proto_name,
                                                JS::HandleObject parent);
 
 JSObject *       gjs_cairo_solid_pattern_from_pattern   (JSContext       *context,
diff --git a/modules/cairo-ps-surface.cpp b/modules/cairo-ps-surface.cpp
index a26be4e..b412419 100644
--- a/modules/cairo-ps-surface.cpp
+++ b/modules/cairo-ps-surface.cpp
@@ -31,7 +31,7 @@
 #if CAIRO_HAS_PS_SURFACE
 #include <cairo-ps.h>
 
-GJS_DEFINE_PROTO("CairoPSSurface", cairo_ps_surface, JSCLASS_BACKGROUND_FINALIZE)
+GJS_DEFINE_PROTO("PSSurface", cairo_ps_surface, JSCLASS_BACKGROUND_FINALIZE)
 
 GJS_NATIVE_CONSTRUCTOR_DECLARE(cairo_ps_surface)
 {
diff --git a/modules/cairo-radial-gradient.cpp b/modules/cairo-radial-gradient.cpp
index 3c222a2..7a9d6a1 100644
--- a/modules/cairo-radial-gradient.cpp
+++ b/modules/cairo-radial-gradient.cpp
@@ -28,7 +28,8 @@
 #include <cairo.h>
 #include "cairo-private.h"
 
-GJS_DEFINE_PROTO("CairoRadialGradient", cairo_radial_gradient, JSCLASS_BACKGROUND_FINALIZE)
+GJS_DEFINE_PROTO("RadialGradient", cairo_radial_gradient,
+                 JSCLASS_BACKGROUND_FINALIZE)
 
 GJS_NATIVE_CONSTRUCTOR_DECLARE(cairo_radial_gradient)
 {
diff --git a/modules/cairo-region.cpp b/modules/cairo-region.cpp
index 324ec30..c210bc7 100644
--- a/modules/cairo-region.cpp
+++ b/modules/cairo-region.cpp
@@ -37,7 +37,9 @@ typedef struct {
     cairo_region_t *region;
 } GjsCairoRegion;
 
-GJS_DEFINE_PROTO_WITH_GTYPE("CairoRegion", cairo_region, CAIRO_GOBJECT_TYPE_REGION, 
JSCLASS_BACKGROUND_FINALIZE)
+GJS_DEFINE_PROTO_WITH_GTYPE("Region", cairo_region,
+                            CAIRO_GOBJECT_TYPE_REGION,
+                            JSCLASS_BACKGROUND_FINALIZE)
 GJS_DEFINE_PRIV_FROM_JS(GjsCairoRegion, gjs_cairo_region_class);
 
 static cairo_region_t *
diff --git a/modules/cairo-solid-pattern.cpp b/modules/cairo-solid-pattern.cpp
index 0651dc5..04cb276 100644
--- a/modules/cairo-solid-pattern.cpp
+++ b/modules/cairo-solid-pattern.cpp
@@ -28,7 +28,8 @@
 #include <cairo.h>
 #include "cairo-private.h"
 
-GJS_DEFINE_PROTO_ABSTRACT("CairoSolidPattern", cairo_solid_pattern, JSCLASS_BACKGROUND_FINALIZE)
+GJS_DEFINE_PROTO_ABSTRACT("SolidPattern", cairo_solid_pattern,
+                          JSCLASS_BACKGROUND_FINALIZE)
 
 static void
 gjs_cairo_solid_pattern_finalize(JSFreeOp *fop,
diff --git a/modules/cairo-surface-pattern.cpp b/modules/cairo-surface-pattern.cpp
index ae1a6b3..a06a1fe 100644
--- a/modules/cairo-surface-pattern.cpp
+++ b/modules/cairo-surface-pattern.cpp
@@ -28,7 +28,8 @@
 #include <cairo.h>
 #include "cairo-private.h"
 
-GJS_DEFINE_PROTO("CairoSurfacePattern", cairo_surface_pattern, JSCLASS_BACKGROUND_FINALIZE)
+GJS_DEFINE_PROTO("SurfacePattern", cairo_surface_pattern,
+                 JSCLASS_BACKGROUND_FINALIZE)
 
 GJS_NATIVE_CONSTRUCTOR_DECLARE(cairo_surface_pattern)
 {
diff --git a/modules/cairo-surface.cpp b/modules/cairo-surface.cpp
index d55030b..aa42e09 100644
--- a/modules/cairo-surface.cpp
+++ b/modules/cairo-surface.cpp
@@ -37,7 +37,9 @@ typedef struct {
     cairo_surface_t *surface;
 } GjsCairoSurface;
 
-GJS_DEFINE_PROTO_ABSTRACT_WITH_GTYPE("CairoSurface", cairo_surface, CAIRO_GOBJECT_TYPE_SURFACE, 
JSCLASS_BACKGROUND_FINALIZE)
+GJS_DEFINE_PROTO_ABSTRACT_WITH_GTYPE("Surface", cairo_surface,
+                                     CAIRO_GOBJECT_TYPE_SURFACE,
+                                     JSCLASS_BACKGROUND_FINALIZE)
 GJS_DEFINE_PRIV_FROM_JS(GjsCairoSurface, gjs_cairo_surface_class)
 
 static void
diff --git a/modules/cairo-svg-surface.cpp b/modules/cairo-svg-surface.cpp
index cb9f15d..ef8df69 100644
--- a/modules/cairo-svg-surface.cpp
+++ b/modules/cairo-svg-surface.cpp
@@ -31,7 +31,8 @@
 #if CAIRO_HAS_SVG_SURFACE
 #include <cairo-svg.h>
 
-GJS_DEFINE_PROTO("CairoSVGSurface", cairo_svg_surface, JSCLASS_BACKGROUND_FINALIZE)
+GJS_DEFINE_PROTO("SVGSurface", cairo_svg_surface,
+                 JSCLASS_BACKGROUND_FINALIZE)
 
 GJS_NATIVE_CONSTRUCTOR_DECLARE(cairo_svg_surface)
 {
diff --git a/modules/cairo.cpp b/modules/cairo.cpp
index 02c202f..662cb33 100644
--- a/modules/cairo.cpp
+++ b/modules/cairo.cpp
@@ -61,61 +61,61 @@ gjs_js_define_cairo_stuff(JSContext              *context,
 {
     module.set(JS_NewObject(context, NULL));
 
-    if (!gjs_cairo_region_create_proto(context, module, "Region", JS::NullPtr()))
+    if (!gjs_cairo_region_create_proto(context, module, JS::NullPtr()))
         return false;
     gjs_cairo_region_init(context);
 
-    if (!gjs_cairo_context_create_proto(context, module, "Context", JS::NullPtr()))
+    if (!gjs_cairo_context_create_proto(context, module, JS::NullPtr()))
         return false;
     gjs_cairo_context_init(context);
 
     JS::RootedObject surface_proto(context,
-        gjs_cairo_surface_create_proto(context, module, "Surface", JS::NullPtr()));
+        gjs_cairo_surface_create_proto(context, module, JS::NullPtr()));
     if (!surface_proto)
         return false;
     gjs_cairo_surface_init(context);
 
     JS::RootedObject image_surface_proto(context,
-        gjs_cairo_image_surface_create_proto(context, module, "ImageSurface", surface_proto));
+        gjs_cairo_image_surface_create_proto(context, module, surface_proto));
     if (!image_surface_proto)
         return false;
     gjs_cairo_image_surface_init(context, image_surface_proto);
 
 #if CAIRO_HAS_PS_SURFACE
-    if (!gjs_cairo_ps_surface_create_proto(context, module, "PSSurface", surface_proto))
+    if (!gjs_cairo_ps_surface_create_proto(context, module, surface_proto))
         return false;
 #endif
 
 #if CAIRO_HAS_PDF_SURFACE
-    if (!gjs_cairo_pdf_surface_create_proto(context, module, "PDFSurface", surface_proto))
+    if (!gjs_cairo_pdf_surface_create_proto(context, module, surface_proto))
         return false;
 #endif
 
 #if CAIRO_HAS_SVG_SURFACE
-    if (!gjs_cairo_svg_surface_create_proto(context, module, "SVGSurface", surface_proto))
+    if (!gjs_cairo_svg_surface_create_proto(context, module, surface_proto))
         return false;
 #endif
 
     JS::RootedObject pattern_proto(context,
-        gjs_cairo_pattern_create_proto(context, module, "Pattern", JS::NullPtr()));
+        gjs_cairo_pattern_create_proto(context, module, JS::NullPtr()));
     if (!pattern_proto)
         return false;
 
     JS::RootedObject gradient_proto(context,
-        gjs_cairo_gradient_create_proto(context, module, "Gradient", pattern_proto));
+        gjs_cairo_gradient_create_proto(context, module, pattern_proto));
     if (!gradient_proto)
         return false;
 
-    if (!gjs_cairo_linear_gradient_create_proto(context, module, "LinearGradient", gradient_proto))
+    if (!gjs_cairo_linear_gradient_create_proto(context, module, gradient_proto))
         return false;
 
-    if (!gjs_cairo_radial_gradient_create_proto(context, module, "RadialGradient", gradient_proto))
+    if (!gjs_cairo_radial_gradient_create_proto(context, module, gradient_proto))
         return false;
 
-    if (!gjs_cairo_surface_pattern_create_proto(context, module, "SurfacePattern", pattern_proto))
+    if (!gjs_cairo_surface_pattern_create_proto(context, module, pattern_proto))
         return false;
 
-    if (!gjs_cairo_solid_pattern_create_proto(context, module, "SolidPattern", pattern_proto))
+    if (!gjs_cairo_solid_pattern_create_proto(context, module, pattern_proto))
         return false;
 
     return true;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]